
import {requestInfo} from '@/api/public.js'

/**
 * 设备
 */
export class DeviceService {
    // 分页查询列表
    static findDevices (queryParams) {
        return requestInfo({
            url: '/repair/repairManagement/Device/findDevices',
            method: 'POST',
            data: queryParams
        });
    }

    //根据ID查询指定的设备
    static findDevice (deviceId) {
        const query = {
            deviceId
        }
        return requestInfo({
            url: '/repair/repairManagement/Device/findDevice',
            method: 'POST',
            params: query,
        });
    }

    //根据ID查询指定的设备(包含外键名称)
    static findDeviceForView (deviceId) {
        const query = {
            deviceId
        }
        return requestInfo({
            url: '/repair/repairManagement/Device/findDeviceForView',
            method: 'POST',
            params: query,
        });
    }

    //根据ID查询指定的设备(包含外键名称)
    static findDeviceForEdit (deviceId) {
        const query = {
            deviceId
        }
        return requestInfo({
            url: '/repair/repairManagement/Device/findDeviceForEdit',
            method: 'POST',
            params: query,
        });
    }

    //根据ID查询指定的设备(只提取ID 和 Name)
    static findDevicesWithIdNameById (deviceId) {
        const query = {
            deviceId
        }
        return requestInfo({
            url: '/repair/repairManagement/Device/findDevicesWithIdNameById',
            method: 'POST',
            params: query,
        });
    }

    //根据名称查询设备集合(只提取ID 和 Name)
    static findDevicesWithIdNameByName (deviceName) {
        const query = {
            deviceName
        }
        return requestInfo({
            url: '/repair/repairManagement/Device/findDevicesWithIdNameByName',
            method: 'POST',
            params: query,
        });
    }

    //新增保存设备
    static saveDevice (device) {
        const query = {}
        return requestInfo({
            url: '/repair/repairManagement/Device/saveDevice',
            method: 'POST',
            params: query,
            data: device
        });
    }

    //修改保存设备
    static updateDevice (device) {
        const query = {}
        return requestInfo({
            url: '/repair/repairManagement/Device/updateDevice',
            method: 'POST',
            params: query,
            data: device
        });
    }

    //根据ID查询指定的设备(只提取ID 和 Name)
    static deleteDevice (deviceId) {
        const query = {
            deviceId
        }
        return requestInfo({
            url: '/repair/repairManagement/Device/deleteDevice',
            method: 'POST',
            params: query,
        });
    }
    //根据管理用户查询设备集合
    static findDevicesByUser (userId) {
        const query = {
            userId
        }
        return requestInfo({
            url: '/repair/repairManagement/Device/findDevicesByUser',
            method: 'POST',
            params: query,
        });
    }

    static findDeviceByCode(deviceCode) {
        const query = {
            deviceCode
        }
        return requestInfo({
            url: '/repair/repairManagement/Device/findDeviceByCode',
            method: 'POST',
            params: query,
        });
    }
}
